<script>
import PubSub from "pubsub-js"
export default {
  props:["user","editUser"],
  data() {
    return {
      formInline: {
        user: '',
        region: ''
      }
    }
  },
  methods: {
    onSubmit() {
      console.log('submit!');
    },
    test(){//发布订阅消息,只要有订阅即可接收
      console.log(this.$emit("addUser",user))
      PubSub.publish("msg",this.test1);
    },test1(){
      console.log("test1测试函数！")
    }
  }
}
</script>


<template>
  <el-form :inline="true" :model="formInline" class="demo-form-inline" id="search">
    <span>{{user}}</span>
    <el-form-item label="搜索">
      <el-input v-model="formInline.user" placeholder="请输入"></el-input>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="onSubmit">查询</el-button>
      <el-button type="primary" @click="test">测试</el-button>
    </el-form-item>
  </el-form>
</template>

<style scoped>
    #search{
      width: 700px;
      position: fixed;
      margin-top: -350px;
      margin-left: 50px;
    }
</style>
